package com.hsource.doctorcenter.manager;

import com.hsource.common.utils.RedisTopicUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.listener.ChannelTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author yangYang
 * @version 1.0
 * @date 2020/10/12 16:01
 * @describe
 */
@Component
public class LoadConsumer {
    @Autowired
    private OrderNotifyTerminalManager orderNotifyTerminalManager;
    @Autowired
    private RedisMessageListenerContainer messageListenerContainer;

    @PostConstruct
    public void load(){
        messageListenerContainer.addMessageListener(orderNotifyTerminalManager, new ChannelTopic(RedisTopicUtil.TOPIC_ORDER_CENTER));
        orderNotifyTerminalManager.addChannel(RedisTopicUtil.TOPIC_ORDER_CENTER);
    }
}
